home *** CD-ROM | disk | FTP | other *** search
/ PD Collection CD 1 / PD Collection CD 1.iso / textual / gnudiff / Notes / DiffBugs next >
Text File  |  1991-05-02  |  9KB  |  319 lines

  1. Path: cix!slxsys!ukc!mcsun!uunet!tut.cis.ohio-state.edu!unreplyable!garbage
  2. From: dillon@overload.berkeley.ca.us (Matthew Dillon)
  3. Newsgroups: gnu.utils.bug
  4. Subject: BUG/COMPAT REPORT FOR DIFF-1.15.TAR
  5. Message-ID: <9102161054.AA03555@overload.Berkeley.CA.US>
  6. Date: 16 Feb 91 10:54:02 GMT
  7. Sender: daemon@tut.cis.ohio-state.edu
  8. Distribution: gnu
  9. Organization: GNUs Not Usenet
  10. Lines: 261
  11. Approved: bug-gnu-utils@prep.ai.mit.edu
  12.  
  13.  
  14.     Hello, I have a bug / compatibility report for you.  A few of the
  15.     problems relate to a few unimplemented features in my C compiler,
  16.     DICE, which you may or may not want to incorporate.  However,
  17.     there are some genuine bugs / problems too.
  18.  
  19.     diff.h needs to include regex.h, forgot exactly where the problem
  20.     was, some structure that was referenced but not defined due to
  21.     no regex.h being included for that source module.
  22.  
  23.     diff.h is also missing an EXTERN keyword on one of the structures,
  24.     yielding multiple-defined symbols on my machine.
  25.  
  26.     The changes to DIR.C relate to my compiler not being able to handle
  27.     structural returns yet (but I'm working on it!  I just got dynamic
  28.     stack extension working so at least I can run the GNU stack hogging
  29.     programs now!)
  30.  
  31.     IO.C calculates a table index from a hash value via the mod operator
  32.     without checking for possible negative results due to the signed
  33.     int used for the hash value.  This could be a bug in my compiler, I
  34.     cannot remember whether mod is supposed to be able to return
  35.     negative numbers or not.  In anycase, it seemed dangerous.
  36.  
  37.     REGEX.C, a ?: construction has an expression return value of char *,
  38.     but the second result is 0, which came back a warning on my compiler
  39.     (again, this may be a non-bug since 0 == NULL by definition which is
  40.     a valid pointer type)
  41.  
  42.     finally, I added #ifndef AMIGA's around the fork/wait code for
  43.     the paginator.  While I can write unix support routines for everything
  44.     else, fork() is a major problem on the amiga (instead, we spawn
  45.     independant processes.  The amiga uses a linear address space).
  46.  
  47.     --
  48.  
  49.     In anycase, that's the bug report.  Thanks for diff & patch !
  50.  
  51.     P.S. double check that the indenting hasn't been screwed up due to
  52.     the retabbing.
  53.  
  54.                     -Matt
  55.  
  56.     Matthew Dillon        dillon@Overload.Berkeley.CA.US
  57.     891 Regal Rd.        uunet.uu.net!overload!dillon
  58.     Berkeley, Ca. 94708
  59.     USA
  60.  
  61. diff -c -w diff.old/diff.h diff/diff.h
  62. *** diff.old/diff.h    Sun Jan 06 23:04:45 1991
  63. --- diff/diff.h Fri Feb 15 16:38:06 1991
  64. ***************
  65. *** 22,27 ****
  66. --- 22,28 ----
  67.   #include <stdio.h>
  68.   #include <sys/types.h>
  69.   #include <sys/stat.h>
  70. + #include "regex.h"
  71.  
  72.   #ifdef USG
  73.   #include <time.h>
  74. ***************
  75. *** 318,324 ****
  76.  
  77.   /* Describe the two files currently being compared.  */
  78.  
  79. ! struct file_data files[2];
  80.   
  81.   /* Queue up one-line messages to be printed at the end,
  82.      when -l is specified.  Each message is recorded with a `struct msg'.  */
  83. --- 319,325 ----
  84.  
  85.   /* Describe the two files currently being compared.  */
  86.  
  87. ! EXTERN struct file_data files[2];
  88.   
  89.   /* Queue up one-line messages to be printed at the end,
  90.      when -l is specified.  Each message is recorded with a `struct msg'.  */
  91. diff -c -w diff.old/dir.c diff/dir.c
  92. *** diff.old/dir.c    Thu Nov 29 21:15:42 1990
  93. --- diff/dir.c    Fri Feb 15 13:05:01 1991
  94. ***************
  95. *** 31,37 ****
  96.     char **files;            /* Sorted names of files in the dir */
  97.   };
  98.  
  99. ! static struct dirdata
  100.   dir_sort (dirname, nonex)
  101.        char *dirname;
  102.        int nonex;
  103. --- 31,37 ----
  104.     char **files;        /* Sorted names of files in the dir */
  105.   };
  106.  
  107. ! static struct dirdata *
  108.   dir_sort (dirname, nonex)
  109.        char *dirname;
  110.        int nonex;
  111. ***************
  112. *** 38,44 ****
  113.   {
  114.     register DIR *reading;
  115.     register struct direct *next;
  116. !   struct dirdata dirdata;
  117.  
  118.     /* Address of block containing the files that are described.  */
  119.     char **files;
  120. --- 38,44 ----
  121.   {
  122.     register DIR *reading;
  123.     register struct direct *next;
  124. !   static struct dirdata dirdata;
  125.  
  126.     /* Address of block containing the files that are described.    */
  127.     char **files;
  128. ***************
  129. *** 53,59 ****
  130.       {
  131.     dirdata.length = 0;
  132.     dirdata.files = 0;
  133. !    return dirdata;
  134.       }
  135.  
  136.     /* Open the directory and check for errors.  */
  137. --- 53,59 ----
  138.       {
  139.     dirdata.length = 0;
  140.     dirdata.files = 0;
  141. !    return &dirdata;
  142.       }
  143.  
  144.     /* Open the directory and check for errors.  */
  145. ***************
  146. *** 62,68 ****
  147.       {
  148.     perror_with_name (dirname);
  149.     dirdata.length = -1;
  150. !    return dirdata;
  151.       }
  152.  
  153.     /* Initialize the table of filenames.  */
  154. --- 62,68 ----
  155.       {
  156.     perror_with_name (dirname);
  157.     dirdata.length = -1;
  158. !    return &dirdata;
  159.       }
  160.  
  161.     /* Initialize the table of filenames.  */
  162. ***************
  163. *** 101,107 ****
  164.     dirdata.files = files;
  165.     dirdata.length = files_index;
  166.  
  167. !   return dirdata;
  168.   }
  169.  
  170.   /* Sort the files now in the table.  */
  171. --- 101,107 ----
  172.     dirdata.files = files;
  173.     dirdata.length = files_index;
  174.  
  175. !   return &dirdata;
  176.   }
  177.  
  178.   /* Sort the files now in the table.  */
  179. ***************
  180. *** 144,151 ****
  181.     int v1;
  182.  
  183.     /* Get sorted contents of both dirs.  */
  184. !   data1 = dir_sort (name1, nonex1);
  185. !   data2 = dir_sort (name2, nonex2);
  186.     if (data1.length == -1 || data2.length == -1)
  187.       {
  188.     if (data1.length >= 0)
  189. --- 144,151 ----
  190.     int v1;
  191.  
  192.     /* Get sorted contents of both dirs.    */
  193. !   data1 = *dir_sort (name1, nonex1);
  194. !   data2 = *dir_sort (name2, nonex2);
  195.     if (data1.length == -1 || data2.length == -1)
  196.       {
  197.     if (data1.length >= 0)
  198. diff -c -w diff.old/io.c diff/io.c
  199. *** diff.old/io.c    Thu Nov 29 21:15:43 1990
  200. --- diff/io.c    Sat Feb 16 02:33:26 1991
  201. ***************
  202. *** 549,555 ****
  203.  
  204.     /* Check through the appropriate bucket to see if there isn't already
  205.        an equivalence class for this line. */
  206. !   bucket = current->linbuf[n].hash % nbuckets;
  207.     b = buckets[bucket];
  208.     while (b)
  209.       {
  210. --- 549,555 ----
  211.  
  212.     /* Check through the appropriate bucket to see if there isn't already
  213.        an equivalence class for this line. */
  214. !   bucket = (current->linbuf[n].hash & 0x7FFFFFFF) % nbuckets;
  215.     b = buckets[bucket];
  216.     while (b)
  217.       {
  218. diff -c -w diff.old/regex.c diff/regex.c
  219. *** diff.old/regex.c    Thu Nov 29 21:21:43 1990
  220. --- diff/regex.c    Fri Feb 15 13:14:11 1991
  221. ***************
  222. *** 857,863 ****
  223.           BUFPUSH (stackp[-1]);
  224.         }
  225.           stackp -= 2;
  226. !        fixup_jump = *stackp ? *stackp + bufp->buffer - 1 : 0;
  227.         laststart = *--stackp + bufp->buffer;
  228.           break;
  229.  
  230. --- 857,863 ----
  231.           BUFPUSH (stackp[-1]);
  232.         }
  233.           stackp -= 2;
  234. !          fixup_jump = *stackp ? *stackp + bufp->buffer - 1 : (char *)0;
  235.           laststart = *--stackp + bufp->buffer;
  236.           break;
  237.  
  238. diff -c -w diff.old/util.c diff/util.c
  239. *** diff.old/util.c    Sun Jan 06 23:14:14 1991
  240. --- diff/util.c Fri Feb 15 18:49:19 1991
  241. ***************
  242. *** 131,136 ****
  243. --- 131,137 ----
  244.  
  245.     if (paginate_flag)
  246.       {
  247. + #ifndef AMIGA
  248.     int pipes[2];
  249.     int desc;
  250.  
  251. ***************
  252. *** 162,167 ****
  253. --- 163,169 ----
  254.       close (pipes[0]);
  255.       outfile = fdopen (pipes[1], "w");
  256.     }
  257. + #endif
  258.       }
  259.     else
  260.       {
  261. ***************
  262. *** 187,194 ****
  263. --- 189,198 ----
  264.   {
  265.     if (outfile != stdout)
  266.       {
  267. + #ifndef AMIGA
  268.     fclose (outfile);
  269.     wait (0);
  270. + #endif
  271.       }
  272.   }
  273.   
  274.  
  275. Stuart A. Malone writes:
  276.  
  277.     First, the lack of a newline in the diff does not correspond to a lack
  278.     of a newline on line b, but rather on line c, which is deceptive.
  279.  
  280. This is a bug in GNU DIFF 1.14.  Here is a patch.
  281.  
  282.     *** old/io.c    Tue Jul 31 14:49:55 1990
  283.     --- new/io.c    Tue Jul 31 14:49:20 1990
  284.     ***************
  285.     *** 270,276 ****
  286.             ++p;
  287.           }
  288.       
  289.     !   if (output_style == OUTPUT_RCS && current->missing_newline)
  290.           --current->linbuf[current->buffered_lines - 1].length;
  291.       
  292.         i = 0;
  293.     --- 270,278 ----
  294.             ++p;
  295.           }
  296.       
  297.     !   if (output_style == OUTPUT_RCS
  298.     !       && current->missing_newline
  299.     !       && current->suffix_begin == current->buffer + current->buffered_chars)
  300.           --current->linbuf[current->buffered_lines - 1].length;
  301.       
  302.         i = 0;
  303.  
  304.  
  305. Malone also writes:
  306.  
  307.     Second, programs like RCS and ED expect such scripts to _always_ end in
  308.     a newline, and execute the script incorrectly when they do not.  When
  309.     producing scripts for RCS or ED, GNU DIFF should always end its output
  310.     with a newline.
  311.  
  312. This is a bug in RCS and ED, not in DIFF.  RCS 4.2 and traditional ED do not
  313. properly handle a file that ends in a character other than a newline.  I think
  314. the next major release of RCS will work with such files.  Perhaps GNU ED will
  315. work with them, too, although a minor enhancement to ED's command set is
  316. probably needed.
  317.  
  318.  
  319.